import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DeliveryPlanOutStockVO, DeliveryPlanOutStockForm, DeliveryPlanOutStockQuery } from '@/api/delivery/deliveryPlanOutStock/types';

/**
 * 查询发货计划断货列表
 * @param query
 * @returns {*}
 */

export const listDeliveryPlanOutStock = (query?: DeliveryPlanOutStockQuery): AxiosPromise<DeliveryPlanOutStockVO[]> => {
  return request({
    url: '/delivery/deliveryPlanOutStock/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询发货计划断货详细
 * @param id
 */
export const getDeliveryPlanOutStock = (id: string | number): AxiosPromise<DeliveryPlanOutStockVO> => {
  return request({
    url: '/delivery/deliveryPlanOutStock/' + id,
    method: 'get'
  });
};

/**
 * 新增发货计划断货
 * @param data
 */
export const addDeliveryPlanOutStock = (data: DeliveryPlanOutStockForm) => {
  return request({
    url: '/delivery/deliveryPlanOutStock',
    method: 'post',
    data: data
  });
};

/**
 * 修改发货计划断货
 * @param data
 */
export const updateDeliveryPlanOutStock = (data: DeliveryPlanOutStockForm) => {
  return request({
    url: '/delivery/deliveryPlanOutStock',
    method: 'put',
    data: data
  });
};

/**
 * 删除发货计划断货
 * @param id
 */
export const delDeliveryPlanOutStock = (id: string | number | Array<string | number>) => {
  return request({
    url: '/delivery/deliveryPlanOutStock/' + id,
    method: 'delete'
  });
};
